<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\login;
use App\Http\Controllers\index;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    $users = DB::table('goods')
        ->orderBy('created_at', 'desc')
        ->get();

    $goods = DB::table('goods')
        ->orderBy('join', 'asc')
        ->get();

    $row = DB::table('goods')
        ->orderBy('join', 'desc')
        ->get();


    return view('index', ['goods' => $goods,'users' => $users,'row'=>$row]);
});

//前端首页页面路由
 Route::match(['get', 'post'], 'index',[index::class,'index']);
 //全部商品路由
 Route::match(['get', 'post'], 'qbsp',[index::class,'qbsp']);
// 最新开奖
 Route::match(['get', 'post'], 'zxkj',[index::class,'zxkj']);
// 常见问题
Route::match(['get', 'post'], 'cjwt',[index::class,'cjwt']);
// 夺宝记录
 Route::match(['get', 'post'], 'dbjl',[index::class,'dbjl']);
// 商品详情页
 Route::match(['get', 'post'], 'xq{id}',[index::class,'xq']);
// 往期揭晓
 Route::match(['get', 'post'], 'wqjx',[index::class,'wqjx']);
// 所有参与记录
 Route::match(['get', 'post'], 'sycyjl',[index::class,'sycyjl']);
// 立即夺宝 路由 进入立即夺宝之前走中间件检查是否登入
 Route::match(['get', 'post'], 'ljdb',[index::class,'ljdb'])->middleware('efficacy');;
//夺宝规则
Route::match(['get', 'post'], 'dbgz',[index::class,'dbgz']);
//ajax获取数据
Route::match(['get', 'post'], 'ajax_z',[index::class,'ajax_z']);

//个人信息页面路由
Route::match(['get', 'post'], 'my_sz_zh',[index::class,'my_sz_zh']);
//登录页面路由
Route::match(['get', 'post'], 'denglu',[login::class,'denglu']);
//登录功能路由
Route::match(['get', 'post'], 'se_login',[login::class,'se_login']);
//注册页面路由
Route::match(['get', 'post'], 'register',[login::class,'register']);
//注册功能路由
Route::match(['get', 'post'], 'se_register',[login::class,'se_register']);
//退出登录
Route::match(['get', 'post'], 'sign_out',[login::class,'sign_out']);


//后台页面路由
Route::match(['get', 'post'], 'admin',[\App\Http\Controllers\Admin::class,'admin']);
Route::match(['get', 'post'], 'console',[\App\Http\Controllers\Admin::class,'console']);
Route::match(['get', 'post'], 'goods',[\App\Http\Controllers\Admin::class,'goods']);
Route::match(['get', 'post'], 'goods_add',[\App\Http\Controllers\Admin::class,'goods_add']);
Route::match(['get', 'post'], 'goods_ok',[\App\Http\Controllers\Admin::class,'goods_ok']);
Route::match(['get', 'post'], 'users',[\App\Http\Controllers\Admin::class,'users']);
Route::match(['get', 'post'], 'users_add',[\App\Http\Controllers\Admin::class,'users_add']);
Route::match(['get', 'post'], 'users_ok',[\App\Http\Controllers\Admin::class,'users_ok']);

//后台登录路由
Route::match(['get', 'post'], 'adminlogin',[\App\Http\Controllers\Adminlogin::class,'adminlogin']);
Route::match(['get', 'post'], 'login_ok',[\App\Http\Controllers\Adminlogin::class,'login_ok']);
Route::match(['get', 'post'], 'login_out',[\App\Http\Controllers\Adminlogin::class,'login_out']);









//测试数据
Route::match(['get', 'post'], 'draw',[index::class,'draw']);
